package com.neutech.demo.day02;

public class Demo01 {
    public static void main(String[] args) {
        Boolean boo = confirmResult(3, 7, 3);
        System.out.println(boo);
    }

    public static Boolean confirmResult(double a, double b, double c) {
        double deltao = b * b - 4 * a * c;
        if (deltao >= 0) {
            if (deltao == 0) {
                double result = -b / (2 * a);
                System.out.println("有俩个相同的解为" + result);
            } else if (deltao > 0) {
                double result1 = (-b + Math.sqrt(deltao)) / (2 * a);
                double result2 = (-b - Math.sqrt(deltao)) / (2 * a);
                System.out.println("有两个不同的解,第一个解为" + result1 + "第二个解为" + result2);
            } else {
                System.out.println("无解");
                return false;
            }
        }

        return true;

    }
}
